package com.atuguigu.boot3.core.service;

import com.atuguigu.boot3.core.entity.User;
import com.atuguigu.boot3.core.event.LoginSuccessEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;

@Service
public class CouponService {
    @EventListener
    public void onEvent(LoginSuccessEvent event){
        System.out.println("优惠券收到监听信息");
       User user =(User) event.getSource();
//        String username = user.getUsername();

        //sendCoupon(username);
    }
    public void sendCoupon(String username){
        System.out.println(username+"获得了购物券");
    }
}
